{% extends "admin/base_site.html" %}
{% load compress i18n %}
{% load staticfiles %}
{% load widgy_tags %}

{% block extrahead %}
{{ block.super }}
{% compress css %}
<link rel="stylesheet" href="{% static 'widgy/fancybox/jquery.fancybox-1.3.4.css' %}">
<link rel="stylesheet" href="{% static 'widgy/css/history.scss' %}" type="text/x-scss">
{% endcompress %}
{% compress js %}
<script src="{% static 'widgy/fancybox/jquery.fancybox-1.3.4.js' %}"></script>
<script src="{% static 'widgy/js/widgy.admin.js' %}"></script>
{% endcompress %}
{% endblock  %}

{% block content %}
<section class="main">
  <h1>{% trans "Page History" %}</h1>
<ol class="history">
    {% for commit in commits %}
    <li>
      <div class="top">
        {% block commit_info %}
        <strong>{{ commit.created_at|date:"SHORT_DATETIME_FORMAT" }}</strong>
        {% if commit.author %}{% blocktrans with author=commit.author %} by <strong>{{ author }}</strong>.{% endblocktrans %}{% endif %}
          {% if commit.publish_at > commit.created_at  %}
            (
            {% if not commit.is_published %}
              <span title="{% trans "Not live yet" %}">
              {% trans "Scheduled to be published at" %}
            {% else %}
              {% trans "Published at" %}
            {% endif %}
              {{ commit.publish_at|date:"SHORT_DATETIME_FORMAT" }}.
            )
            {% if not commit.is_published %}
              *</span>
            {% endif %}
          {% endif %}
        {% endblock %}
          <div class="actions">
            {% block commit_actions %}
            {% has_add_permission site commit.tracker commit as can_revert %}
            {% if commit.root_node != commit.tracker.head.root_node and can_revert %}
              <a class="button widgy-fancybox" href="{% reverse_site_url site 'revert_view' pk=commit.tracker.pk commit_pk=commit.pk %}">{% trans "Revert to this Version" %}</a>
            {% elif can_revert %}
              {% trans "Can't revert; this is the same as the current version." %}
            {% endif %}
            {% for diff_url in commit.diff_urls %}
              <a class="button diff" href="{{ diff_url }}">{% trans "Diff" %}</a>
            {% endfor %}
            {% for owner in object.owners %}
              {% get_action_links owner commit.root_node as links %}
              {% for link in links %}
                <a class="button {{ link.type }}" target="_blank" href="{{ link.url }}">{{ link.text }}</a>
              {% endfor %}
            {% endfor %}
            {% endblock %}
          </div>
      </div>
      {% if commit.message %}
        <blockquote>{{ commit.message|linebreaks }}</blockquote>
      {% endif %}
    </li>
    {% endfor %}
</ol>
</section>
{% endblock %}
